Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU: More robust error reporting #10958

Merged
merged 13 commits into from
Sep 27, 2024

Conversation

thatcosmonaut
Copy link
Collaborator

Resolves #10779

I rewrote a lot of error checking so that functions that can fail will bubble up the error to the caller. There is no longer a distinction between logging or setting an error because failures will always set an error. In debug mode the error function will also log.

Commands do not return errors. Since their execution is deferred, the expectation is that the graphics API's validator layer will catch those.

Most graphics errors are not sanely recoverable, but the client can now at least check for errors and report them before crashing.

Needs a Metal implementation before merge.

include/SDL3/SDL_gpu.h Outdated Show resolved Hide resolved
include/SDL3/SDL_gpu.h Outdated Show resolved Hide resolved
if (
commandBufferHeader->render_pass.in_progress ||
commandBufferHeader->compute_pass.in_progress ||
commandBufferHeader->copy_pass.in_progress) {
SDL_assert_release(!"Cannot submit command buffer while a pass is in progress!");
return;
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should set an error (and maybe log in debug mode instead of asserting?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An assert is infinitely more useful here for debugging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our intention was to assert in gpu.c in debug mode because the errors we catch there are client misuses.

@flibitijibibo flibitijibibo added this to the 3.0 ABI milestone Sep 26, 2024
@thatcosmonaut
Copy link
Collaborator Author

Currently making sure that we're logging errors in debug mode and then this is good to go.

@flibitijibibo flibitijibibo marked this pull request as ready for review September 27, 2024 02:48
@flibitijibibo
Copy link
Collaborator

Looks like Haiku CI went down... this should be clear to squash once it's back up and green.

@thatcosmonaut thatcosmonaut merged commit be401dd into libsdl-org:main Sep 27, 2024
39 checks passed
@thatcosmonaut thatcosmonaut deleted the error_bubbling branch September 27, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPU: Functions that may return errors should call SDL_SetError()
5 participants